package com.mall.bargain.controller;

import com.mall.bargain.service.BargainingRecordService;
import com.mall.bargain.service.IReceiveAddressService;
import com.mall.common.response.CommonResponse;
import com.mall.entity.bargain.BgReceiveAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LiJinYang
 * @version 1.0
 * @email 283006176@qq.com
 * @date 2021/07/20 14:12
 * 砍价记录
 */
@RestController
@RequestMapping("/bargaining")
@CrossOrigin
public class BargainingRecordController {
    @Autowired
    private BargainingRecordService bargainingRecordService;
    @Autowired
    private IReceiveAddressService iReceiveAddressService;

    /**
     * 查询用户已砍的砍价商品
     * @param uid 用户ID
     * @return
     */
    @GetMapping("/findAll")
    private CommonResponse findAll(Long uid){
        return bargainingRecordService.findAll(uid);
    }

    /**
     *查询单个砍价商品的详情
     * @param id 商品ID
     * @return
     */
    @GetMapping("/findById")
    public CommonResponse findById(Long id){
        return bargainingRecordService.findById(id);
    }

    /**
     * 每个商品的砍价记录表
     * @param id 商品ID
     * @return
     *
     */
    @GetMapping("/record")
    public CommonResponse record(Integer id){
        return bargainingRecordService.record(id);
    }

    /**
     * 我的订单中展示代发货商品
     * @param id 用户ID
     * @param status 商品状态
     * @return
     */
    @GetMapping("/myOrder")
    public CommonResponse myOrder(Integer id,String status){
        return bargainingRecordService.myOrder(id,status);
    }

    /**
     * 查看订单的地址
     * @param id 订单ID
     * @return
     */
    @GetMapping("/orderAddress")
    public BgReceiveAddress orderAddress(Integer id){
        return  iReceiveAddressService.orderAddress(id);
    }






}
